<html> 
<head> 
 
<link type="text/css" href="./mysource_files/common.css" rel="stylesheet" />  
<link type="text/css" href="./mysource_files/news.css" rel="stylesheet" />       
        
<script type="text/javascript" src="./mysource_files/jquery-1.3.2.min.js"></script> 
<script type="text/javascript" src="./mysource_files/jquery-ui-1.7.2.custom.min.js"></script> 

</head> 
<body>


<div class="page_container">
	<!-- News title -->
  <div class="page_title">News Archive</div>

	<!-- Description -->
  <div class="page_description page_box">
    <p>
    Review COSI's current news as well as the previous archive. The news archive is an active feature of the COSI website and is an ideal source of information relating to open source software development.
    </p>
  </div>
<div class="control_bar page_box" style="background:url(./mysource_files/menumap_item.png) repeat-x center;" >
        <div class="refine_bar page_box" style="background:none;"> 
  
       
        <div class="page_box" style="left:0px; top:0px; width:250px; border:none; padding:inherit; height:25px; background:none;">
			
                   
<div  id="tags_container" style="left:0px; position:absolute; top:25px; width:250px; height:300px; z-index:1; border:1px solid #ccc; border-top:none;">
</div>
            
            <a class="text_tags">Filter by tag</a>
	        <div id="tags_dropdown" class="button" style="border-left:1px solid #e1e1e1; border-right:1px solid #e1e1e1; right:0px; top:0px; height:25px; width:20px; background:url(./mysource_files/down_idle.png) no-repeat center;">
			</div>
		</div>
        
        <div class="page_box" style="left:260px; top:0px; width:160px; border:none; padding:inherit; height:25px; background:none;">
            <a class="text_tags">
            Only with external sources
            </a>
			 <div id="toggle_external_sources" class="button" style=" border-left:1px solid #e1e1e1; border-right:1px solid #e1e1e1; right:0px; top:0px; height:25px; width:20px; background:url(./mysource_files/button_unchecked.png) no-repeat center;">
			</div>
        </div>
	</div>
    <div class="navigate_bar page_box" style="background:none;">
     
      <div class="page_box" style="left:0px; top:0px; width:280px; border:none; padding:inherit; height:25px; background:none;"> 
        <a id="nav_first" class="text_tags" style="left:10px; width:50px; cursor:pointer;"><< First</a>
        <a id="nav_prev" class="text_tags" style="left:60px; width:60px; cursor:pointer;">< Previous</a>        
        <a id="nav_next" class="text_tags" style="left:180px; width:60px; cursor:pointer;">Next ></a>        
        <a id="nav_last" class="text_tags" style="left:230px; width:50px; cursor:pointer;">Last >></a>        
        </div>
    </div>
</div>
</div>
	</div>
<div style="position:absolute; left:1px; top:171px; right:1px; height:580px; font-size:12px; background:#eee; font-size:12px; border-bottom:1px solid #ddd; border-top:1px solid #eee; background-color:fff; font-family:Arial, Helvetica, sans-serif; color:#444;">
  
<div class="news_list" style="background:#e5e5e5;" id="content_div_122"> 
    
    <div class="query_news_item"> 
        <div class ="query_date">
            2009-11-11
        </div> 
        <div class="query_title">A news item title #1</div> 
        <div class ="query_summary">
        Linux.com reports: The Burton Corporation shifted its SAP-related infrastructure from HP-UX on proprietary big iron to SUSE Linux Enterprise Server (SLES) on commodity boxes last year.&nbsp; 
        </div> 
        <div class ="query_url">http://cosi.scms.waikato.ac.nz/news-items/2009/11/linux-is-crunchy-for-burtons-sap-ops</div> 
        <div class ="query_tags">Killzone</div> 
    </div> 
    
    <div class="query_news_item"> 
        <div class ="query_date">
            2009-11-11
        </div> 
        <div class="query_title">A news item title #2</div> 
        <div class ="query_summary">
        Linux.com reports: The Burton Corporation shifted its SAP-related infrastructure from HP-UX on proprietary big iron to SUSE Linux Enterprise Server (SLES) on commodity boxes last year.&nbsp; 
        </div> 
        <div class ="query_url">http://cosi.scms.waikato.ac.nz/news-items/2009/11/linux-is-crunchy-for-burtons-sap-ops</div> 
        <div class ="query_tags">Killzone</div> 
    </div> 
    
    <div class="query_news_item"> 
        <div class ="query_date">
            2009-11-11
        </div> 
        <div class="query_title">A news item title #3</div> 
        <div class ="query_summary">
        Linux.com reports: The Burton Corporation shifted its SAP-related infrastructure from HP-UX on proprietary big iron to SUSE Linux Enterprise Server (SLES) on commodity boxes last year.&nbsp; 
        </div> 
        <div class ="query_tags">Killzone</div> 
	</div> 
    
    <div class="query_news_item"> 
        <div class ="query_date">
            2009-11-11
        </div> 
        <div class="query_title">A news item title #4</div> 
        <div class ="query_summary">
        Linux.com reports: The Burton Corporation shifted its SAP-related infrastructure from HP-UX on proprietary big iron to SUSE Linux Enterprise Server (SLES) on commodity boxes last year.&nbsp; 
        </div> 
        <div class ="query_url">http://cosi.scms.waikato.ac.nz/news-items/2009/11/linux-is-crunchy-for-burtons-sap-ops</div> 
        <div class ="query_tags">Killzone, Timeshift</div> 
    </div> 
<div class="query_news_item"> 
        <div class ="query_date">
            2009-11-11
        </div> 
        <div class="query_title">A news item title #5</div> 
        <div class ="query_summary">
        Linux.com reports: The Burton Corporation shifted its SAP-related infrastructure from HP-UX on proprietary big iron to SUSE Linux Enterprise Server (SLES) on commodity boxes last year.&nbsp; 
        </div> 
        <div class ="query_url">http://cosi.scms.waikato.ac.nz/news-items/2009/11/linux-is-crunchy-for-burtons-sap-ops</div> 
        <div class ="query_tags">Killzone, Timeshift, Motostorm</div> 
    </div><div class="query_news_item"> 
        <div class ="query_date">
            2009-11-11
        </div> 
        <div class="query_title">5</div> 
        <div class ="query_summary">
        Linux.com reports: The Burton Corporation shifted its SAP-related infrastructure from HP-UX on proprietary big iron to SUSE Linux Enterprise Server (SLES) on commodity boxes last year.&nbsp; 
        </div> 
        <div class ="query_url">http://cosi.scms.waikato.ac.nz/news-items/2009/11/linux-is-crunchy-for-burtons-sap-ops</div> 
        <div class ="query_tags">Killzone, Timeshift, Motostorm</div> 
    </div>
    
    <div class="query_news_item"> 
        <div class ="query_date">
            2009-11-11
        </div> 
        <div class="query_title">5</div> 
        <div class ="query_summary">
        Linux.com reports: The Burton Corporation shifted its SAP-related infrastructure from HP-UX on proprietary big iron to SUSE Linux Enterprise Server (SLES) on commodity boxes last year.&nbsp; 
        </div> 
        <div class ="query_url">http://cosi.scms.waikato.ac.nz/news-items/2009/11/linux-is-crunchy-for-burtons-sap-ops</div> 
        <div class ="query_tags">Killzone, Timeshift, Motostorm</div> 
    </div> 
 

</div>
    
	</div>
    
  
</div>


</div>
</div>
<script type="text/javascript"> 

var g_newsPositions = null;
var g_newsPerPage = 4;
var g_newsSourcesOnly = false;
 

function itemHasTag(itemIndex, tag) {
	
	var tagsString = $( $(".query_tags") [itemIndex]  ).text();

	var tagsArray = tagsString.split(',');

	for(var i = 0; i < tagsArray.length; i++){
		
		if($.trim(tagsArray[i].toLowerCase()) == $.trim(tag.toLowerCase())){
			return true;
		}
	}
	
	return false;
}

function updateNewsPane(position, tag) {
 		
	var filterString = ".query_news_item";
if(	g_newsSourcesOnly)
filterString += ":has(.query_url)";
	
		var $newsItems;
		if(tag != null) { 
			$newsItems = $(filterString).filter( function(index) {							
				return(itemHasTag(index, tag));
			});
		}
		else {
			$newsItems = $(filterString);
		}

		var totalNewsItems = $newsItems.length;
		var nextPosition = position;
	if(nextPosition < 0)
		nextPosition = 0;
	else if(nextPosition + g_newsPerPage + 1 > totalNewsItems)
		nextPosition = totalNewsItems - g_newsPerPage;

	if(nextPosition == g_newsPositions && !tag)
		return;
	g_newsPositions = nextPosition;
	
	$(".news_list").fadeOut('fast', function() {

		if(tag != null)
	 $(".query_news_item").hide();
	 
		for(var i = 0; i < totalNewsItems; i++) {
			
			if(i < g_newsPositions || i > g_newsPositions + g_newsPerPage - 1)
				$($newsItems[i]).hide();
			else
				$($newsItems[i]).show();
		}
			$(".news_list").fadeIn('fast');								 
											 });
}

function NewsTag(key) {
	
	this.key = key;
	this.count = 0;
}

var g_topTags = new Array();
var g_currentTag = null;
function initNewsTags() {

	var tags = new Array();
	$(".query_tags").each(function () {

		var tagsString = $(this).text();
		var tagsArray = tagsString.split(',');
		
		for(var i = 0; i < tagsArray.length; i++) {
			
			var tagString = tagsArray[i];
			if(tags.length == 0) {
				
			tags.push(new NewsTag(tagString));
			
			}
			else {
				for(var j = 0; j < tags.length; j++) {
				
					if(tagString == tags[j].key) {
						tags[j].count++;
						break;
					}
					else if(j == tags.length - 1) {
						tags.push(new NewsTag(tagString));
					}
			}
			}
		}
	});
	
	function sortTag(a,b) {
		return (a.count > b.count) ? -1 : 1;
	}
	
	for(var i = 0; i < tags.length && i < 20; i++) {

		//alert(tags[i].key + "," + tags[i].count );
		g_topTags.push(tags[i]);
	}
	
	g_topTags.sort(sortTag);
	
	g_topTags.push(new NewsTag(null));
		var padding = 5;
		
	for(i = 0; i < g_topTags.length; i++) {
		
		var key = g_topTags[i].key;
		var count = g_topTags[i].count;		

		var $keyText;
		var jsHideTagMenu = "$(\"#tags_container\").hide(\"blind\");";
		if(key == null){
						
			var jsOnclick = "g_currentTag = null;updateNewsPane(0, g_currentTag);" + jsHideTagMenu; 
			$keyText = $(("<div onclick='" + jsOnclick + "'>Clear filter</div>"));
		}
		else {
			var jsOnclick = "g_currentTag = \"" + g_topTags[i].key + "\";updateNewsPane(0, g_currentTag);" + jsHideTagMenu; 
			$keyText = $(("<div onclick='" + jsOnclick + "'>" + key + " (" + count + ")" + "</div>"));
		}
		var color = (i % 2 == 0) ? "#eee" : "#eaeaea";
		var width = $("#tags_container").css("width") - 2 * padding;
		$keyText.css({"width" : width, "height" : 20, "padding" : padding, "background" : color, "cursor" : "pointer"}); 
		$("#tags_container").append($keyText);
	}
	
	$("#tags_container").css("height", (g_topTags.length * (20 + padding * 2)));

	delete tags;	
}

$(document).ready(function() {     

	var totalNewsItems = $(".query_news_item").length;
	var totalNewsPages = totalNewsItems / g_newsPerPage;
	
	if(!(totalNewsPages > 1)) {
		$(".navigate_bar").hide();
	}
	
	$("#tags_container").hide();
	$("#tags_dropdown").click( function() {	
		$("#tags_container").toggle('blind');
		});
	
	initNewsTags();
	$(".query_url").hide();
	$(".query_tags").hide();
	$(".news_list").hide();
	 $(".query_news_item").hide();
	 g_currentTag= null;
	updateNewsPane(0, g_currentTag);
//		$("#tags_container").show();
	
	$("#toggle_external_sources").toggle( function() {
		$(this).css({"background" : "url(./mysource_files/button_checked.png) no-repeat center"});
		g_newsSourcesOnly = true;
		updateNewsPane(0, g_currentTag);
		
												   },
											function() {
		$(this).css({"background" : "url(./mysource_files/button_unchecked.png) no-repeat center"});
		g_newsSourcesOnly = false;
		updateNewsPane(0, g_currentTag);
												   });
												  
	
	$("#nav_first").click( function() {
		
		updateNewsPane(0, g_currentTag);
		});
	$("#nav_prev").click( function() {
		
		updateNewsPane(g_newsPositions - g_newsPerPage, g_currentTag);
		});
	$("#nav_last").click( function() {
		
		updateNewsPane(totalNewsItems - totalNewsPages, g_currentTag);
		});
	$("#nav_next").click( function() {
		
		updateNewsPane(g_newsPositions + g_newsPerPage, g_currentTag);
		});
	
});
 

 
 
</script>
</body> 
</html> 